package cn.bugstack.domain.strategy.service.rule.chain.impl;

import cn.bugstack.domain.strategy.service.armory.IStrategyDispatch;
import cn.bugstack.domain.strategy.service.rule.chain.AbstractLogicChain;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @Title: DefaultLogicChain
 * @Author 程志琨
 * @Package cn.bugstack.domain.strategy.service.rule.chain.impl
 * @Date 2025/3/1 23:40
 * @description: 兜底规则责任链节点
 */
@Slf4j
@Component("default")
public class DefaultLogicChain extends AbstractLogicChain {

    // 默认规则，直接抽奖即可
    @Resource
    private IStrategyDispatch strategyDispatch;



    @Override
    public Integer logic(String userId, Long strategyId) {
        Integer awardId = strategyDispatch.getRandomAwardId(strategyId);
        log.info("抽奖责任链-默认处理 userId: {} strategyId: {} ruleModel: {} awardId: {}", userId, strategyId, ruleModel(), awardId);
        return awardId;
    }


    /**
     * 直接返回该子类的规则类型
     * @return 默认兜底规则类型
     */
    @Override
    protected String ruleModel() {
        return "default";
    }



}
